package dao;

import entity.FocussEntity;
import util.IRowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

/**
 * Created by Administrator on 2017/11/14.
 */
public class FocussDao {
    private DBHelper<FocussEntity> dbHelper=new DBHelper<FocussEntity>();
    //查询轮播图片
    public List<FocussEntity> queryImg() throws SQLException, ClassNotFoundException {
        String sql="SELECT img FROM itlb_focuss";
        IRowMapper<FocussEntity> rowMapper=new IRowMapper<FocussEntity>() {
            @Override
            public FocussEntity mapper(ResultSet rs) throws SQLException, ClassNotFoundException {
                FocussEntity fe=new FocussEntity();
                fe.setImg(rs.getString("img"));
                return fe;
            }
        };
        List<FocussEntity> list=dbHelper.queryAllHelper(rowMapper,sql);
        return list;
    }
    //关闭
    public void close()throws SQLException{
        dbHelper.close();
    }
}
